<!doctype html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<title>Populating multiselect control from the server</title>

	<script src="../../codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../codebase/ext/dhtmlxscheduler_multiselect.js" type="text/javascript" charset="utf-8"></script>
	<link rel="stylesheet" href="../../codebase/dhtmlxscheduler.css" type="text/css" title="no title" charset="utf-8">
	
<style type="text/css" media="screen">
	html, body{
		margin:0px;
		padding:0px;
		height:100%;
		overflow:hidden;
	}	
	
	.dhx_multi_select_userselect input {
		vertical-align: middle;
	}
	.dhx_multi_select_fruitselect input {
		vertical-align: middle;
	}

</style>

<script type="text/javascript" charset="utf-8">
	function init() {
		
		scheduler.config.xml_date="%Y-%m-%d %H:%i";
		scheduler.config.prevent_cache = true;
		scheduler.config.first_hour=4;
		scheduler.config.limit_time_select = true;
		scheduler.config.details_on_create=true;
		scheduler.config.details_on_dblclick=true;


		scheduler.templates.event_text = function(start, end, event) {
			var result = event.text+"<br/>Users: ";
			
			var users=[];
			if (event.user_id){
				users = event.user_id.split(",");
				for (var i=0; i < users.length; i++)
					users[i] = scheduler.getLabel("user_id",users[i])
			}
			result += users.join(",");
			
			return result;
		};

		
		scheduler.init('scheduler_here',new Date(2009,10,2),"week");
		scheduler.load("data/events_multiselect_static.php", function(){
			scheduler.showLightbox(108);
		});
		var dp = new dataProcessor("data/events_multiselect_static.php");
		dp.init(scheduler);

		scheduler.locale.labels.section_userselect = "Users";
		scheduler.locale.labels.section_fruitselect = "Fruits";
		scheduler.locale.labels.section_description = "Name";
		scheduler.locale.labels.section_location = "Location";

		scheduler.config.lightbox.sections=[	
			{ name:"description", height:50, map_to:"text", type:"textarea", focus:true },
			{ name:"userselect", height:22, map_to:"user_id", type:"multiselect", options: scheduler.serverList("user_id"), vertical:"false"  },
			{ name:"fruitselect", height:100, map_to:"fruit_id", type:"multiselect", options: scheduler.serverList("fruit_id"), vertical:"true" },
			{ name:"location", height:43, type:"textarea", map_to:"details" },
			{ name:"time", height:72, type:"time", map_to:"auto"}	
		]
	}
</script>
</head>

<body onload="init();">
	<div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
		<div class="dhx_cal_navline">
			<div class="dhx_cal_prev_button">&nbsp;</div>
			<div class="dhx_cal_next_button">&nbsp;</div>
			<div class="dhx_cal_today_button"></div>
			<div class="dhx_cal_date"></div>
			<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
			<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
			<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
		</div>
		<div class="dhx_cal_header">
		</div>
		<div class="dhx_cal_data">
		</div>		
	</div>
</body>